package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.FieldInstructionBytecodeEvent;

public class FieldInstructionBytecodeEventImpl extends BytecodeEventImpl implements FieldInstructionBytecodeEvent
{
    private int opcode;
    private String ownerName;
    private String fieldName;
    private String fieldDescriptor;

    public FieldInstructionBytecodeEventImpl(final int aOpcode, final String aOwnerName, final String aFieldName,
        final String aFieldDescriptor)
    {
        opcode = aOpcode;
        ownerName = aOwnerName;
        fieldName = aFieldName;
        fieldDescriptor = aFieldDescriptor;
    }

    @Override
    public int getType() {
        return FIELD_INSTRUCTION;
    }

    @Override
    public void setOpcode(final int aOpcode) {
        opcode = aOpcode;
    }

    @Override
    public int getOpcode() {
        return opcode;
    }

    @Override
    public void setOwnerName(final String aOwnerName) {
        ownerName = aOwnerName;
    }

    @Override
    public String getOwnerName() {
        return ownerName;
    }

    @Override
    public void setFieldName(final String aFieldName) {
        fieldName = aFieldName;
    }

    @Override
    public String getFieldName() {
        return fieldName;
    }

    @Override
    public void setFieldDescriptor(final String aFieldDescriptor) {
        fieldDescriptor = aFieldDescriptor;
    }

    @Override
    public String getFieldDescriptor() {
        return fieldDescriptor;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitFieldInstruction(this);
        return aBytecodeVisitor;
    }
}
